<template>
  <n-modal v-model:show="showModal" preset="dialog" :show-icon="false">
    <div class="text-center modelTile">角色关联用户</div>
    <n-card>
      <transfer ref="transferref" :origindata="[{'id':'1','name':'11','desc':'111'}]" :colnum="colnums"></transfer>
      <template #action>
        <div class="w-full h-10 flex justify-end items-center">
          <n-button @click="doClose">取消</n-button>
          <n-button @click="handleOK" type="primary">确定</n-button>
        </div>
      </template>
    </n-card>
  </n-modal>
</template>

<script setup name="addusermodel">
import {useRoute, useRouter} from "vue-router";

const router = useRouter()
const route = useRoute()
const transferref = ref(null)
const emit = defineEmits(["shuaxin"])
const colnums = ref([
  {
    type: 'selection', width: 60,
  },
  {
    title: "序号", width: 60, show: true, render: (rowData, rowIndex) => {
      return rowIndex + 1
    }
  },
  {title: "名称", key: "name", width: 80, show: true},
  {title: "描述", key: "desc", width: 80, show: true},
])
const showModal = ref(false)
// 父级数据
const parent = ref({})
const init = (data) => {
  parent.value = data
  showModal.value = true
}
// 关闭弹窗
const doClose = () => {
  showModal.value = false
  emit("shauxin")
  reset()
}
// 重置数据
const reset = () => {
}
// 点击OK
const handleOK = () => {
  transferref.value.jiaoyan((value)=>{
    console.log(value,"选中的数据")
  })
}

// 抛出属性
defineExpose({init, doClose, reset})
</script>

<style scoped>

</style>
